#ifndef _FILEIO_HPP
#define _FILEIO_HPP

#include <windows.h>
#include <fileapi.h>

class WriteFile 
{
public:
	void open();
	void close();
	BOOL write(CONST VOID *pvBuffer,DWORD nNumBytesToWrite);
	virtual ~WriteFile();
	DWORD getWriteBytes() CONST;
protected:
	WriteFile(const LPCWSTR filename);
	DWORD _dwDesiredAccess;
	DWORD _dwShareMode;
	DWORD _dwCreationDisposition;
	DWORD _dwFlagsAndAttributes;
private:
	WriteFile(const WriteFile&);
	WriteFile &operator=(CONST WriteFile&);
	virtual void init() = 0;
	LPCWSTR _fName;
	HANDLE _hfile;
	DWORD _pdwNumBytes;
};

inline WriteFile::WriteFile(const LPCWSTR filename)
	:_fName(filename)
{
	_hfile = INVALID_HANDLE_VALUE;
	_pdwNumBytes = 0;
	_dwDesiredAccess = 0;
	_dwShareMode = 0;
	_dwCreationDisposition = 0;
	_dwFlagsAndAttributes = 0;
}

inline WriteFile::~WriteFile()
{
}

inline DWORD WriteFile::getWriteBytes() CONST
{
	return _pdwNumBytes;
}

class FtpWriteFile : public WriteFile
{
public:
	FtpWriteFile(const LPCWSTR fName);
	virtual ~FtpWriteFile(){}
private:
	virtual void init();
};

#endif
